﻿/***************************************************
//  Copyright (c) Premium Tax Free 2011
/***************************************************/

using System.Collections.Generic;
using System.Configuration;
using PremierTaxFree.PTFLib;
using PremierTaxFree.PTFLib.Data;
using PremierTaxFree.PTFLib.Threading;
using PremierTaxFree.PTFLib.Web;

namespace TransferringService
{
    public class TransferringWorker : CycleWorkerBase
    {
        protected override void ThreadFunction()
        {
            List<DbFileInfo> files = DataAccess.SelectFilesForExport_Client();
            if (files.Count > 0)
            {
                ReceivingWebService client = new ReceivingWebService();
                client.SetUrl(ConfigurationManager.AppSettings[Strings.All_CentralServerUrl]);
                client.SetCreditails("rrossenbg", Strings.PASS, null);

                foreach (var file in files)
                    client.SaveDataXmlText(file.Content);
            }
        }
    }
}
